package io.xxx.xbutler.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.EnumTypeHandler;

import java.time.LocalDateTime;
import java.util.List;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class Robot extends Contact {

    private String phone;

    private Integer platformType;

    private Integer trueName;

    private String qrcode;

    private String qrcodeAddress;

    /**
     * 二维码加密字段
     */
    private String qrCodeEncryption;

    private Integer friendCount;

    private Boolean autoJoinRoom;

    /**
     * 后台是否自动同意加好友申请
     */
    private Boolean autoAddFriend;

    private Boolean allowJoinBigRoom;

    private Boolean online;

    private Boolean enabled;

    private Boolean limited;

    /**
     * 封号状态
     * 10 - 未封号
     * 20 - 疑似封号
     * 30 - 封号
     */
    private Integer sealStatus;

    private Boolean functionLimited;

    @TableField(typeHandler = EnumTypeHandler.class)
    private HeartbeatStatus heartbeatStatus;

    private Integer roomCount;

    private Integer openRoomCount;

    private String deviceId;

    /**
     * 登录方式 10 扫码登录 11 缓存登录
     * <p>
     * 如果该账号为新号，则该登录方式值为10，则平台接下来会回调一个登录二维码给商家，商家拿到nType:1001中的二维码扫码登录；
     * 如果该账号是在平台为老号，则值为11，平台会使用缓存登录，但是缓存登录有可能会失效，
     * 当缓存失效时，平台会自动推送登录二维码给商家，商家使用扫码登录。
     */
    private Integer loginType;

    private Integer logType;

    private String offlineCode;

    private String offlineReason;

    private LocalDateTime offlineTime;

    private Integer todayJoinNum;

    private Integer maxJoinNum;

    private Integer todayJoinedNum;

    private Integer joinedNum;

    private Integer todayAddFriendNum;

    private Integer todayAddedFriendNum;

    private Integer maxAddFriendNum;

    private Integer addedFriendNum;

    private Boolean autoAllowAddFriend;

    private Boolean autoAllowJoinRoom;

    private String blockReason;

    @TableField(exist = false)
    private List<Tag> tags;

    @TableField(typeHandler = EnumTypeHandler.class)
    private RobotType type;

    @TableField(exist = false)
    private List<Contact> contacts;

    @TableField(exist = false)
    private List<Room> rooms;
}
